#include<iostream>
#include <string>
using namespace std;
int chartonum(char num)
{
	int result(0);
	if (num>='0'&&num<='9')
	{
		result=num-'0';
	}
	else
	{
		switch(num)
		{
		case 'a':
		case 'A':
			result=10;
		case 'b':
		case 'B':
			result=10;
		case 'c':
		case 'C':
			result=10;
		case 'd':
		case 'D':
			result=10;
		case 'e':
		case 'E':
			result=10;
		case 'f':
		case 'F':
			result=10;

	

		}
	}
	return result;
}

char numtochar(int num)
{
	char result=num;
	if (num>=0&&num<=9)
	{
		result+=48;
	}
	else{

		switch(num)
		{
		case 10:
			result='A';
		case 11:
			result='B';
		case 12:
			result='C';
		case 13:
			result='D';
		case 14:
			result='E';
		case 15:
			result='F';
		}
	}
	return result;
}

string charhextobianry(char s)
{

	int value=chartonum(s);
	int temp(0);
	string result;
	while(value)
	{		
		temp=value%2;
		result+=numtochar(temp);
		value/=2;
	}
	string realresult=result;
	int j=0;
	for (int i=result.length()-1;i>=0;i--)
	{
		realresult[j++]=result[i];
	}
	return realresult;
}
string hextobianry(char* s)
{
	char *s1=s;
	string result;

	while(*s1!='\0')
	{
		result+=charhextobianry(*s1);
		s1++;
	}
	

	return result;
	
}

int main()
{
	char s[]="3A";
	string s1=hextobianry(s);
	cout<<s1<<endl;
	//string s="12345";
	//string s2=s;
	//int j=0;
	//for (int i=s.length()-1;i>=0;i--)
	//{
	//	s2[j++]=s[i];
	//}
	//cout<<s2<<endl;
}